package cn.securityformail.rabbitmq.workquene;

import cn.securityformail.rabbitmq.util.RabbitMQUtil;
import com.rabbitmq.client.*;
import java.io.IOException;

@SuppressWarnings("all")
public class CustomerTwo {
    public static void main(String[] args) throws IOException {
        Connection connection = RabbitMQUtil.getConnection();

        Channel channel = connection.createChannel();

        channel.queueDeclare("work",true,false,false,null);

        channel.basicConsume("work",true,new DefaultConsumer(channel){
            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                System.out.println("消费者-Two:"+new String(body));
            }
        });
    }
}
